package cn.memorynine.consumer.controller;

import cn.memorynine.consumer.model.shop.manage.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import cn.memorynine.common.model.ResponseWrapper;
import cn.memorynine.consumer.service.ShopManageService;
import cn.memorynine.common.model.ResponseWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.RequestBody;

/**
* 管理后台-商城管理控制器
* @author 代码生成器
*/
@Slf4j
@RestController
@RequestMapping("/admin/ShopManage")
public class ShopManageController {

    @Autowired
    private ShopManageService ShopManageService;

    /**
     * 1.获取全部商品列表
     * @return
     */
    @RequestMapping("/commodityList")
    public ResponseWrapper commodityList(@RequestBody @Validated CommodityListParam param){
        return ShopManageService.commodityList(param);
    }

    /**
     * 1.1 获取全部商品列表-获取全部类别列表
     * @return
     */
    @RequestMapping("/catagoryList")
    public ResponseWrapper catagoryList(@RequestBody @Validated CatagoryListParam param){
        return ShopManageService.catagoryList(param);
    }

    /**
     * 2.新增/修改商品-商品详情
     * @return
     */
    @RequestMapping("/commodityInfo")
    public ResponseWrapper commodityInfo(@RequestBody @Validated CommodityInfoParam param){
        return ShopManageService.commodityInfo(param);
    }

    /**
     *
     */
    @RequestMapping("/catagoryListWithChoose")
    public ResponseWrapper catagoryListWithChoose(@RequestBody @Validated CatagoryListWithChooseParam param){
        return ShopManageService.catagoryListWithChoose(param);
    }

    /**
     * 3.新增/修改商品
     * @return
     */
    @RequestMapping("/saveCommodityInfo")
    public ResponseWrapper saveCommodityInfo(@RequestBody @Validated SaveCommodityInfoParam param){
        return ShopManageService.saveCommodityInfo(param);
    }

    /**
     * 4.上架/下架商品
     * @return
     */
    @RequestMapping("/changeCommodity")
    public ResponseWrapper changeCommodity(@RequestBody @Validated ChangeCommodityParam param){
        return ShopManageService.changeCommodity(param);
    }

    /**
     * 5.获取商品分类列表
     * @return
     */
    @RequestMapping("/commodityTypeList")
    public ResponseWrapper commodityTypeList(@RequestBody @Validated CommodityTypeListParam param){
        return ShopManageService.commodityTypeList(param);
    }

    /**
     * 6.新增/修改商品分类
     * @return
     */
    @RequestMapping("/saveCommodityType")
    public ResponseWrapper saveCommodityType(@RequestBody @Validated SaveCommodityTypeParam param){
        return ShopManageService.saveCommodityType(param);
    }

    /**
     * 7.新增/修改商品分类-商品分类信息
     * @return
     */
    @RequestMapping("/commodityTypeInfo")
    public ResponseWrapper commodityTypeInfo(@RequestBody @Validated CommodityTypeInfoParam param){
        return ShopManageService.commodityTypeInfo(param);
    }

    /**
     * 8.删除商品分类
     * @return
     */
    @RequestMapping("/delCommodityType")
    public ResponseWrapper delCommodityType(@RequestBody @Validated DelCommodityTypeParam param){
        return ShopManageService.delCommodityType(param);
    }

}